#include <iostream>
#include "ColorValue.h"
#include "Light.h"

Light::Light() :
	mLightType(LT_POINT),
	mPosition(Vector3f::ZERO),
	mDiffuse(ColorValue::White),
	mSpecular(ColorValue::Black),
	mDirection(Vector3f::UNIT_Z),
	mSpotFalloff(1.0f),
	mRange(100000),
	mAttenuationConst(1.0f),
	mAttenuationLinear(0.0f),
	mAttenuationQuad(0.0f) {

	}

Light::Light(std::string& name) : mLightName(name) {
}

Light::~Light() {
}

void Light::setType(const LightType& lt) {
	mLightType = lt;
}

Light::LightType Light::getType(void) const {
	return mLightType;
}

void Light::setAmbientColor(float red, float green, float blue, float alpha) {
	mAmbient.r = red;
	mAmbient.g = green;
	mAmbient.b = blue;
	mAmbient.a = alpha;
}

const ColorValue& Light::getAmbientColor(void) const {
	return mAmbient;
}

void Light::setDiffuseColor(float red, float green, float blue, float alpha) {
	mDiffuse.r = red;
	mDiffuse.g = green;
	mDiffuse.b = blue;
	mDiffuse.a = alpha;
}

const ColorValue& Light::getDiffuseColor(void) const {
	return mDiffuse;
}

void Light::setSpecularColor(float red, float green, float blue, float alpha) {
	mSpecular.r = red;
	mSpecular.g = green;
	mSpecular.b = blue;
	mSpecular.a = alpha;
}

const ColorValue& Light::getSpecularColor(void) const {
	return mSpecular;
}

void Light::setPosition(float x, float y, float z) {
	mPosition.x = x;
	mPosition.y = y;
	mPosition.z = z;
}

void Light::setPosition(Vector3f& vec) {
	mPosition.x = vec.x;
	mPosition.y = vec.y;
	mPosition.z = vec.z;
}

const Vector3f& Light::getPosition(void) const {
	return mPosition;
}

void Light::setDirection(float x, float y, float z) {
	mDirection.x = x;
	mDirection.y = y;
	mDirection.z = z;
}

const Vector3f& Light::getDirection(void) const {
	return mDirection;
}

void Light::setAttenuation(float range, float constant, float linear, float quadratic) {
	mRange = range;
	mAttenuationConst = constant;
	mAttenuationLinear = linear;
	mAttenuationQuad = quadratic;
}

